﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BCGC.BLL.Helper;
using BCGC.BLL.MailManager;
using BCGC.BLL.BusinessObject.UserAccount;
using System.Globalization;

public partial class Member_mailDetails : MemberBasePage
{
    private int MessageID
    {
        get
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                return Convert.ToInt32(Request.QueryString["id"]);
            else
                return -1;
        }
    }

    public int SenderID
    {
        get
        {
            return Convert.ToInt32(ViewState["_MAIL_SENDER_ID"]);
        }
        set
        {
            ViewState["_MAIL_SENDER_ID"]=value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
        }
    }

   
    private void LoadData()
    {
        PrivateMessage message = PrivateMessage.GetPrivateMessageByMessageID(MessageID);
        if (message != null)
        {
            UserInfo user = UserInfo.GetUserInfoByUserID(message.SenderID);

            imgAvater.ImageUrl = user.UseProfileImage;
            litUserName.Text = user.Username;
            litSubject.Text =Server.HtmlDecode(message.Subject);
            litMessage.Text =Server.HtmlDecode(message.Content);
            lblDate.Text =message.SendDate.ToString("d MMMM", CultureInfo.CreateSpecificCulture("en-US")) +" At "+message.SendDate.ToShortTimeString();
            
            
        }
    }
}
